const CracoLessPlugin = require('craco-less');
const CracoAlias = require("craco-alias");

module.exports = {
  plugins:[
    {
      plugin: CracoAlias,
      options: {
        source: "tsconfig",
        // baseUrl SHOULD be specified
        // plugin does not take it from tsconfig
        baseUrl: "./src",
        // tsConfigPath should point to the file where "baseUrl" and "paths" are specified
        tsConfigPath: "./tsconfig.extend.json"
      }
    },
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: { '@primary-color': '#0070cc' },
            javascriptEnabled: true,
          },
        },
        postcssLoaderOptions: {
          ident: "postcss", 
          plugins: () => [
            require('autoprefixer')(
              {
                overrideBrowserslist: ['last 2 version', '>1%']
              }
            )
           ]
        }
      },
    },
  ]
}